#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main(int argc, char const *argv[])
{
printf("创建进程开始\n");
    pid_t pid = fork();
    printf("fork后\n");
    if(pid<0){
        printf("创建进程失败\n");
        return -1;
    }else if (pid==0)
    {
        printf("我是子进程,我的pid是%d,我的父进程的pid是%d\n",getpid(),getppid());
    }else{
        printf("我是父进程,我的pid是%d,我的子进程的pid是%d\n",getpid(),pid);
    }
    printf("进程即将结束%d\n",getpid());

    return 0;
}
